﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Teein.Proxy.Bot.Helper
{
    public class FunctionHelper
    {
        #region 获取webbrowser的url参数
        /// <summary>
        /// 获取webbrowser的url参数
        /// </summary>
        /// <param name="urlquery"></param>
        /// <param name="queryname"></param>
        /// <returns></returns>
        public static string GetQueryString(string urlquery, string queryname)
        {
            string result = string.Empty;
            string[] para;
            urlquery = urlquery.Replace("?", "");

            string[] namevalues = urlquery.Split("&".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            foreach (string namevalue in namevalues)
            {
                para = namevalue.Split("=".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                if (para[0] == queryname)
                {
                    result = para[1];
                    break;
                }
            }

            return result;
        }
        #endregion
    }
}
